package games.isoMatric.data
{
	import flash.events.Event;
	import flash.events.EventDispatcher;

	public class Player extends EventDispatcher
	{
		public static const DRESS_CHANGE:String = "dress change";
		public static const HAT_CHANGE:String = "hat change";
		public static const FACE_CHANGE:String = "face change";
		public static const STATE_CHANGE:String = "state change";
		public static const DIRECTION_CHANGE:String = "direction change";
		public static const M_STAND:int = 0;
		public static const M_WALK:int = 1;
		public static const DIR_SOUTH:uint 		= 0;
		public static const DIR_SOUTHEAST:uint	= 1;
		public static const DIR_EAST:uint		= 2;
		public static const DIR_NORTHEAST:uint	= 3;
		public static const DIR_NORTH:uint		= 4;
		public static const DIR_NORTHWEST:uint	= 5;
		public static const DIR_WEST:uint		= 6;
		public static const DIR_SOUTHWEST:uint	= 7;
		
		private var m_state:int;			// 状态
		private var m_direction:int;		// 方向
		
		public function Player()
		{
			state = M_STAND;
			direction = DIR_SOUTH;
		}
		
		public function set state(n:int):void
		{
			if(m_state == n)return;
			m_state = n;
			dispatchEvent(new Event(STATE_CHANGE));
		}
		
		public function get state():int
		{
			return m_state;
		}
		
		public function set direction(n:int):void
		{
			if(m_direction == n)return;
			m_direction = n;
			dispatchEvent(new Event(DIRECTION_CHANGE));
		}
		
		public function get direction():int
		{
			return m_direction;
		}
	}
}